import { createRouter, createWebHistory } from "vue-router";
import { getMenu } from "./grants";


export let homeRoutes = [

    {
      /* 轮播图 */
      path: "Banner",
      name: "Banner",
      component:()=>import("../views/Banner/BannerList.vue")
    },
    /* 产品列表 */
    {
      path: "proList",
      name: "proList",
      component:()=>import("../views/pro/proList.vue")
    },
    {
      path: "SecondsKill",
      name: "SecondsKill",
      component:()=>import("../views/pro/SecondsKill.vue")
    },
    {
      path: "RecommendList",
      name: "RecommendList",
      component:()=>import("../views/pro/RecommendList.vue")
    },
    {
      path: "SearchList",
      name: "SearchList",
      component:()=>import("../views/pro/SearchList.vue")
    },
    /* 用户列表 */
    {
      path: "userList",
      name: "userList",
      component:()=>import("../views/User/userList.vue")
    },
    {
      path: "adminList",
      name: "adminList",
      component:()=>import("../views/Admin/adminList.vue")
    },
    /* 数据可视化 */
    {
      path: "echarts",
      name: "echarts",
      component:()=>import("../views/Datavisual/Echarts.vue")
    },
    {
      path: "antvg2",
      name: "antvg2",
      component:()=>import("../views/Datavisual/Antvg2.vue")
    },
    
    {
      path: "antdCharts",
      name: "antdCharts",
      component:()=>import("../views/Datavisual/AntdCharts.vue")
    },
    /* 编辑器 */
    {
      path: "Markdown",
      name: "Markdown",
      component:()=>import("../views/Edit/Markdown.vue")
    },
    {
      path: "RichText",
      name: "RichText",
      component:()=>import("../views/Edit/RichText.vue")
    },
    /* 导入导出 */
    {
      path: "ExportExcel",
      name: "ExportExcel",
      component:()=>import("../views/ImportExport/ExportExcel.vue")
    },
    {
      path: "ImportExcel",
      name: "ImportExcel",
      component:()=>import("../views/importExport/ImportExcel.vue")
    },
    /* 地图 */
    {
      path: "BaiDuMap",
      name: "BaiDuMap",
      component: ()=> import ("../views/UseMap/BaiDuMap.vue")
    },
    {
      path: "GaoDeMap",
      name: "GaoDeMap",
      component: ()=> import("../views/UseMap/GaoDeMap.vue")
    },
    {
      path: "TenXunMap",
      name: "TenXunMap",
      component: ()=> import ("../views/UseMap/TenXunMap.vue")
    },
    {
      path: "Service",
      name: "Service",
      component: ()=> import ("../views/Customer/service.vue")
    }

  ]


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "",
      redirect: "/Login"
    },
    {
      path: "/Login",
      name: "Login",
      component: ()=>import("../views/Login.vue"),
    },
    {
      path: "/home",
      name: "home",
      component: ()=>import("../views/home.vue"),
    },
  ],
});
let checkedkeys = JSON.parse(localStorage.getItem("menukeys") as string);
if (checkedkeys != null){
  let menus = getMenu(checkedkeys, router)
}
export default router;
